package com.shixianjun.sort;

public class SortAnalysisReport {

    public long startTime;
    public long endTime;
    public long duration;


    public boolean resultPass = true;
    public boolean isStable = true;

    public SortCase[] cases;

    public void addCase(SortCase aCase, int index) {
        aCase.same = aCase.same();
        aCase.stable = aCase.stable();

        if (!aCase.same) {
            this.resultPass = false;
        }

        if (!aCase.stable) {
            this.isStable = false;
        }

        this.cases[index] = aCase;
    }

    public void print(boolean printCase, boolean onlyNoPass, boolean onlyNoStable) {

        if (printCase) {
            for (int i = 0; i < cases.length; i++) {

                SortCase aCase = cases[i];
                if (onlyNoPass && aCase.same) continue;
                if (onlyNoStable && aCase.stable) continue;

                System.out.print(i + ". start ----------------------------\n");
                aCase.print();
                System.out.print(i + ". end   ----------------------------\n");
            }
        }

        System.out.print("总耗时(ms)：" + this.duration + "\n");
    }
}
